package com.lxw.station.other;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.lxw.station.service.RestTemplateService;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.experimental.Accessors;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

@Data
@Accessors(chain = true)
class ArticleQuery{
    private String title;
    private String url;
    private String type;

}
public class ArticleRatingQuery {
    @SneakyThrows
    public static void main(String[] args) {
        //extracted2();
        List<Article> articles = articleList();
        for (Article article : articles) {
            System.out.println(article.getArticleId());
        }

    }

    private static void extracted2() throws IOException {
        String curl = "curl 'https://bizapi.csdn.net/trends/api/v1/get-article-score' \\\n" +
                "  -H 'authority: bizapi.csdn.net' \\\n" +
                "  -H 'accept: application/json, text/plain, */*' \\\n" +
                "  -H 'accept-language: zh-CN,zh;q=0.9' \\\n" +
                "  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryyM5iAlskbOYgzbTA' \\\n" +
                "  -H 'cookie: UserName=weixin_41883161; UserInfo=df8468dc31a3423c9e3b97d8b3d95433; UserToken=df8468dc31a3423c9e3b97d8b3d95433; UserNick=%E4%B9%9D%E8%BD%AC%E6%88%90%E5%9C%A3; AU=435; UN=weixin_41883161; BT=1703914744977; p_uid=U010000; Hm_up_6bcd52f51e9b3dce32bec4a3997715ac=%7B%22islogin%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isonline%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isvip%22%3A%7B%22value%22%3A%220%22%2C%22scope%22%3A1%7D%2C%22uid_%22%3A%7B%22value%22%3A%22weixin_41883161%22%2C%22scope%22%3A1%7D%7D; historyList-new=%5B%5D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ICjM_GXgIFYAscmNbd9HrnjtXcfGIRYHo_cWtTdM9Dk4MyFyk6NOBOkHCgbwOinDLvA3tNRZ9cn_SBVh7CXClxdV-R-uY0K-x-RazgYN61sh4vJZ_P71HSfa-H84YNtYZKqEZvjZ14LhQX-EK7yjW9vzQIrZa6KKjQlqokbudhnumAu07P5pVUJishSuzm_-Z1-wz4zmRXQkTR8nd4SEu2JbBZf8p59BpuEusKuZuii4us9l-pbXs5E8qovkKZ9BpuEusLvhlCnT2uqDF.; c_segment=12; Hm_lvt_6bcd52f51e9b3dce32bec4a3997715ac=1714117431,1714118766,1714731126,1714954254; x_inscode_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjcmVkZW50aWFsIjoiIiwiY3NkblVzZXJuYW1lIjoid2VpeGluXzQxODgzMTYxIiwidXNlcklkIjoiNjYzOTk1YzMyNjE4YzMwODVhYmUwZDViIiwidXNlcm5hbWUiOiJ3ZWl4aW5fNDE4ODMxNjEifQ.It4L9S_EfVc7loT9Kb-KDnhOW0UO2IH8RDTDKMq8_Yg; FCNEC=%5B%5B%22AKsRol8HxL3xKDVvwO3ajFZ_G_kuwMFivuUv63rJz1F8MQAepvLQ_x4ccfcEZpbx52f5BaArwTLiKqifasc-wFOAd-CWE7e5PLqxpe4wkkWRNrDI1E8rxJd6jIm4OEDoRANUyXVVv1m4c3florWNZGEm_xv-WEds-w%3D%3D%22%5D%5D; dc_sid=02577cd8519dd07074f8384b96a2c498; c_dl_um=-; c_dl_prid=1715414122136_477430; c_dl_rid=1715582754004_965528; c_dl_fref=https://so.csdn.net/so/search; c_dl_fpage=/download/weixin_38696143/13693145; weixin_41883161comment_new=1715730508727; SidecHatdocDescBoxNum=true; c_utm_source=1966961068; firstDie=1; _clck=1jbjtos%7C2%7Cflt%7C0%7C1547; creative_btn_mp=3; fe_request_id=1715838478932_0821_2780691; toolbar_remind_num=3; SESSION=98ce947d-ccd9-4713-9d43-cb46b6b1b728; dc_session_id=10_1715860012715.323111; __cf_bm=f0yy3OkROv.rMLRQES6cQni1w2aQBOvzUZAC8gA5Llg-1715860013-1.0.1.1-2fUFcrvFfSdyEm1x6P8t0A7BSx_sBg4F1MHntl8zSA1c9LySiGVxQr2S2dfdazSCKB7Jqu.rr3E6ONJIZtsGjg; c_pref=https%3A//i.csdn.net/; c_ref=https%3A//www.baidu.com/link; c_first_ref=www.baidu.com; c_first_page=https%3A//blog.csdn.net/m0_63764493/article/details/135531957; c_dsid=11_1715860014718.536674; c_page_id=default; log_Id_pv=5750; Hm_lpvt_6bcd52f51e9b3dce32bec4a3997715ac=1715860015; cf_clearance=PB.UUulSseRnJdrybgSM0c6OTDp4xcP5Sl5.g7lKAWc-1715860014-1.0.1.1-qgptfmR1ticj9NTz1BOsNS3oQk3Ro5nFbuuT40Fqeq4f06YwxUBw.RH9GiMP1SjgdQxLhmO6gcR9DYE4TRI2pw; __gads=ID=e178dd4e39d8ad04:T=1706317465:RT=1715860014:S=ALNI_MYkyVWSlk-Kzbw0VW2ayT8Fdd7uew; __gpi=UID=00000cf0ce6b4c82:T=1706317465:RT=1715860014:S=ALNI_MZEafCfOQxoxIm_c06ogQ91O33nLA; __eoi=ID=9ac79b6815dae14b:T=1706317465:RT=1715860014:S=AA-AfjaAr5lqq4C03q_QgQgjzv38; log_Id_view=131653; _clsk=v7zqxh%7C1715860022247%7C2%7C0%7Cu.clarity.ms%2Fcollect; log_Id_click=6645; dc_tos=sdkug8' \\\n" +
                "  -H 'origin: https://www.csdn.net' \\\n" +
                "  -H 'referer: https://www.csdn.net/qc?utm_source=1966961068' \\\n" +
                "  -H 'sec-ch-ua: \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"' \\\n" +
                "  -H 'sec-ch-ua-mobile: ?0' \\\n" +
                "  -H 'sec-ch-ua-platform: \"Windows\"' \\\n" +
                "  -H 'sec-fetch-dest: empty' \\\n" +
                "  -H 'sec-fetch-mode: cors' \\\n" +
                "  -H 'sec-fetch-site: same-site' \\\n" +
                "  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.289 Safari/537.36' \\\n" +
                "  -H 'x-ca-key: 203930474' \\\n" +
                "  -H 'x-ca-nonce: 130086ff-8567-4265-acbe-ec165cb065a0' \\\n" +
                "  -H 'x-ca-signature: cTmRNfdg4gLK1bMZxPJwbD4mWs/SaPqSkUQ/I8vtT1o=' \\\n" +
                "  -H 'x-ca-signature-headers: x-ca-key,x-ca-nonce' \\\n" +
                "  -H 'x-ca-signed-content-type: multipart/form-data' \\\n" +
                "  --compressed";
        String url = "https://bizapi.csdn.net/trends/api/v1/get-article-score";
        HttpHeaders httpHeaders = RestTemplateService.getHttpHeaders(curl);
        List<String> list = new ArrayList<>();
        for (Article article : articleList()) {
            try {

                String title = article.getTitle();
                String articleUrl = article.getUrl();
                int type = article.getType();
                if (2 == type) {
                    continue;
                }
                MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
                map.add("url",articleUrl);
                HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, httpHeaders);
                String response = RestTemplateService.restTemplate.postForObject(url, request, String.class);
                String score = JSON.parseObject(response).getJSONObject("data").getString("score");
                String message = JSON.parseObject(response).getJSONObject("data").getString("message");
                StringBuilder builder = new StringBuilder();
                builder.append(title).append("\t");
                builder.append(score).append("\t");
                builder.append(message).append("\t");
                builder.append(articleUrl).append("\t");
                list.add(builder.toString());
                Thread.sleep(500);
            }catch (Exception e){

            }
        }

        for (String s : list) {
            System.out.println(s);
        }
    }
    private static void extracted() throws IOException {
        String curl = "curl 'https://bizapi.csdn.net/trends/api/v1/get-article-score' \\\n" +
                "  -H 'authority: bizapi.csdn.net' \\\n" +
                "  -H 'accept: application/json, text/plain, */*' \\\n" +
                "  -H 'accept-language: zh-CN,zh;q=0.9' \\\n" +
                "  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryyM5iAlskbOYgzbTA' \\\n" +
                "  -H 'cookie: UserName=weixin_41883161; UserInfo=df8468dc31a3423c9e3b97d8b3d95433; UserToken=df8468dc31a3423c9e3b97d8b3d95433; UserNick=%E4%B9%9D%E8%BD%AC%E6%88%90%E5%9C%A3; AU=435; UN=weixin_41883161; BT=1703914744977; p_uid=U010000; Hm_up_6bcd52f51e9b3dce32bec4a3997715ac=%7B%22islogin%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isonline%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isvip%22%3A%7B%22value%22%3A%220%22%2C%22scope%22%3A1%7D%2C%22uid_%22%3A%7B%22value%22%3A%22weixin_41883161%22%2C%22scope%22%3A1%7D%7D; historyList-new=%5B%5D; uuid_tt_dd=10_21307064330-1712106032279-539596; management_ques=1713486561164; ssxmod_itna=mqIx9DnDBD0DyjDzhD2eEt3+aYYGQPQrsteHDlrxWTeGzDAxn40iDtPoXQ/2l6RihqWDNZuDqaY9GS5pNf4ODaRrFDCPGnDBKhNrWexii9DCeDIDWeDiDG4Gm94GtDpxG=Djjtz1M6xYPDEj5DRpPDuxBGDGP1LaKhDeKD0xTFDQ9hLxDrOrY1H35xkbxPLxG1540HLA3qL=gf6RGzkt8Ex+bODl9UDCI1tKypDB+kl1HGmGiTYexNha33zgxqCiDxwD+HsiG43lhPZCDxqi2DQBjBHlQDirxqF7pDD=; ssxmod_itna2=mqIx9DnDBD0DyjDzhD2eEt3+aYYGQPQrsteD61/OiD0y54i=2DL70AiNkKkn4n4P8QAr2qihe3SMvRNP1Dex=p7D8G3Wm42bhoP+cjKC8yX3MK=YF58Vaf7aIsY49=Z+caws0bmgRh4Pi4=V4fiXi3QyjTQc8MEeVE6fWqL3x+bqcCj9IfT8/moY1kfY6Qdogl2iOCraTa6E0QA+QWYZ8rAsfoKKnpIyCjPp/xe68wHhbm+8IlnHSM5q4nvNCzx60LENwRAG2d2+kuf1Ht3+fabCcxxGC3U6Ax8UkaR7SkBE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f5BaArwTLiKqifasc-wFOAd-CWE7e5PLqxpe4wkkWRNrDI1E8rxJd6jIm4OEDoRANUyXVVv1m4c3florWNZGEm_xv-WEds-w%3D%3D%22%5D%5D; dc_sid=02577cd8519dd07074f8384b96a2c498; c_dl_um=-; c_dl_prid=1715414122136_477430; c_dl_rid=1715582754004_965528; c_dl_fref=https://so.csdn.net/so/search; c_dl_fpage=/download/weixin_38696143/13693145; weixin_41883161comment_new=1715730508727; SidecHatdocDescBoxNum=true; c_utm_source=1966961068; firstDie=1; _clck=1jbjtos%7C2%7Cflt%7C0%7C1547; creative_btn_mp=3; fe_request_id=1715838478932_0821_2780691; toolbar_remind_num=3; SESSION=98ce947d-ccd9-4713-9d43-cb46b6b1b728; dc_session_id=10_1715860012715.323111; __cf_bm=f0yy3OkROv.rMLRQES6cQni1w2aQBOvzUZAC8gA5Llg-1715860013-1.0.1.1-2fUFcrvFfSdyEm1x6P8t0A7BSx_sBg4F1MHntl8zSA1c9LySiGVxQr2S2dfdazSCKB7Jqu.rr3E6ONJIZtsGjg; c_pref=https%3A//i.csdn.net/; c_ref=https%3A//www.baidu.com/link; c_first_ref=www.baidu.com; c_first_page=https%3A//blog.csdn.net/m0_63764493/article/details/135531957; c_dsid=11_1715860014718.536674; c_page_id=default; log_Id_pv=5750; Hm_lpvt_6bcd52f51e9b3dce32bec4a3997715ac=1715860015; cf_clearance=PB.UUulSseRnJdrybgSM0c6OTDp4xcP5Sl5.g7lKAWc-1715860014-1.0.1.1-qgptfmR1ticj9NTz1BOsNS3oQk3Ro5nFbuuT40Fqeq4f06YwxUBw.RH9GiMP1SjgdQxLhmO6gcR9DYE4TRI2pw; __gads=ID=e178dd4e39d8ad04:T=1706317465:RT=1715860014:S=ALNI_MYkyVWSlk-Kzbw0VW2ayT8Fdd7uew; __gpi=UID=00000cf0ce6b4c82:T=1706317465:RT=1715860014:S=ALNI_MZEafCfOQxoxIm_c06ogQ91O33nLA; __eoi=ID=9ac79b6815dae14b:T=1706317465:RT=1715860014:S=AA-AfjaAr5lqq4C03q_QgQgjzv38; log_Id_view=131653; _clsk=v7zqxh%7C1715860022247%7C2%7C0%7Cu.clarity.ms%2Fcollect; log_Id_click=6645; dc_tos=sdkug8' \\\n" +
                "  -H 'origin: https://www.csdn.net' \\\n" +
                "  -H 'referer: https://www.csdn.net/qc?utm_source=1966961068' \\\n" +
                "  -H 'sec-ch-ua: \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"' \\\n" +
                "  -H 'sec-ch-ua-mobile: ?0' \\\n" +
                "  -H 'sec-ch-ua-platform: \"Windows\"' \\\n" +
                "  -H 'sec-fetch-dest: empty' \\\n" +
                "  -H 'sec-fetch-mode: cors' \\\n" +
                "  -H 'sec-fetch-site: same-site' \\\n" +
                "  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.289 Safari/537.36' \\\n" +
                "  -H 'x-ca-key: 203930474' \\\n" +
                "  -H 'x-ca-nonce: 130086ff-8567-4265-acbe-ec165cb065a0' \\\n" +
                "  -H 'x-ca-signature: cTmRNfdg4gLK1bMZxPJwbD4mWs/SaPqSkUQ/I8vtT1o=' \\\n" +
                "  -H 'x-ca-signature-headers: x-ca-key,x-ca-nonce' \\\n" +
                "  -H 'x-ca-signed-content-type: multipart/form-data' \\\n" +
                "  --compressed";
        String url = "https://bizapi.csdn.net/trends/api/v1/get-article-score";
        HttpHeaders httpHeaders = RestTemplateService.getHttpHeaders(curl);
        String json = new String(Files.readAllBytes(Paths.get("MyArticle")), StandardCharsets.UTF_8);
        JSONArray jsonArray = JSON.parseArray(json);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < jsonArray.size(); i++) {
            try {

                JSONObject jsonObject = jsonArray.getJSONObject(i);
                String title = jsonObject.getString("title");
                String articleUrl = jsonObject.getString("url");
                String type = jsonObject.getString("type");
                if ("2".equals(type)) {
                    continue;
                }
                MultiValueMap<String, String> map= new LinkedMultiValueMap<>();
                map.add("url",articleUrl);
                HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, httpHeaders);
                String response = RestTemplateService.restTemplate.postForObject(url, request, String.class);
                String score = JSON.parseObject(response).getJSONObject("data").getString("score");
                String message = JSON.parseObject(response).getJSONObject("data").getString("message");
                StringBuilder builder = new StringBuilder();
                builder.append(title).append("\t");
                builder.append(score).append("\t");
                builder.append(message).append("\t");
                builder.append(articleUrl).append("\t");
                list.add(builder.toString());
                Thread.sleep(1000);
            }catch (Exception e){

            }
        }
        for (String s : list) {
            System.out.println(s);
        }
    }

    private static List<Article> articleList(){
        String curl = "curl 'https://blog.csdn.net/community/home-api/v1/get-business-list?page=2&size=20&businessType=blog&orderby=&noMore=false&year=&month=&username=weixin_41883161' \\\n" +
                "  -H 'Accept: application/json, text/plain, */*' \\\n" +
                "  -H 'Accept-Language: zh-CN,zh;q=0.9' \\\n" +
                "  -H 'Connection: keep-alive' \\\n" +
                "  -H 'Cookie: UserName=weixin_41883161; UserInfo=df8468dc31a3423c9e3b97d8b3d95433; UserToken=df8468dc31a3423c9e3b97d8b3d95433; UserNick=%E4%B9%9D%E8%BD%AC%E6%88%90%E5%9C%A3; AU=435; UN=weixin_41883161; BT=1703914744977; p_uid=U010000; Hm_up_6bcd52f51e9b3dce32bec4a3997715ac=%7B%22islogin%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isonline%22%3A%7B%22value%22%3A%221%22%2C%22scope%22%3A1%7D%2C%22isvip%22%3A%7B%22value%22%3A%220%22%2C%22scope%22%3A1%7D%2C%22uid_%22%3A%7B%22value%22%3A%22weixin_41883161%22%2C%22scope%22%3A1%7D%7D; historyList-new=%5B%5D; Hm_lvt_e5ef47b9f471504959267fd614d579cd=1713408305; ssxmod_itna=mqIx9DnDBD0DyjDzhD2eEt3+aYYGQPQrsteHDlrxWTeGzDAxn40iDtPoXQ/2l6RihqWDNZuDqaY9GS5pNf4ODaRrFDCP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-EK7yjW9vzQIrZa6KKjQlqokbudhnumAu07P5pVUJishSuzm_-Z1-wz4zmRXQkTR8nd4SEu2JbBZf8p59BpuEusKuZuii4us9l-pbXs5E8qovkKZ9BpuEusLvhlCnT2uqDF.; fpv=993dea6f7cd4c27a546c8c5ab304a99a; Hm_lvt_ec8a58cd84a81850bcbd95ef89524721=1715838560; uuid_tt_dd=10_21307064330-1716010640549-296425; chat-version=2.1.1; cf_clearance=NkYHdrapyaTasSJVmHAg2zpCIKPISIFR68F6rsQJtDA-1716691336-1.0.1.1-wvLgbhTqgj0EodPr1WgAVrqEKGKveBq.hi_3LumC5.YuxHWf1oQrL0dzEQoDNE2DB4.1EU7vvAGIpJyYNAL7lQ; c_dl_fref=https://so.csdn.net/so/search; FCNEC=%5B%5B%22AKsRol-bn4GbaKY3CkWxkSZDIJQARijCEJzOMRAVs1qXgM40p7wD6ZSSKcYm20p3md3IeKNFpfalQY__3ticZygRBjd-S9zB6ZQPJJ_CmxfoDoLqdWsHSE-iUOa0_jTb40d_f_TFfyVvIt9bN8rt7UuG9lJjbwDWlA%3D%3D%22%5D%5D; weixin_41883161comment_new=1716798393344; c_dl_prid=1716691511403_600313; c_dl_rid=1716883536616_236327; c_dl_fpage=/download/weixin_43995604/87431320; c_dl_um=distribute.pc_search_result.none-task-blog-2%7Eall%7Esobaiduend%7Edefault-2-125269232-null-null.142%5Ev100%5Epc_search_result_base1; c_segment=9; dc_sid=25adbca58eb9bd97ac56bab4773f183d; Hm_lvt_6bcd52f51e9b3dce32bec4a3997715ac=1716447468,1716906571,1716910263,1716940616; c_first_ref=default; c_first_page=https%3A//www.csdn.net/%3Fspm%3D1011.2648.3001.4476; is_advert=1; _clck=1jbjtos%7C2%7Cfm7%7C0%7C1547; creative_btn_mp=3; fe_request_id=1717051603689_8501_5519711; __gads=ID=e178dd4e39d8ad04:T=1706317465:RT=1717061163:S=ALNI_MYkyVWSlk-Kzbw0VW2ayT8Fdd7uew; __gpi=UID=00000cf0ce6b4c82:T=1706317465:RT=1717061163:S=ALNI_MZEafCfOQxoxIm_c06ogQ91O33nLA; __eoi=ID=9ac79b6815dae14b:T=1706317465:RT=1717061163:S=AA-AfjaAr5lqq4C03q_QgQgjzv38; dc_session_id=10_1717068633931.163634; c_dsid=11_1717068657244.301608; firstDie=1; c_pref=https%3A//mp.csdn.net/mp_blog/manage/article%3Fspm%3D1001.2101.3001.5448; c_ref=https%3A//i.csdn.net/; c_page_id=default; log_Id_pv=6320; Hm_lpvt_6bcd52f51e9b3dce32bec4a3997715ac=1717070141; log_Id_view=148512; log_Id_click=7466; dc_tos=seasad' \\\n" +
                "  -H 'Referer: https://blog.csdn.net/weixin_41883161?type=blog' \\\n" +
                "  -H 'Sec-Fetch-Dest: empty' \\\n" +
                "  -H 'Sec-Fetch-Mode: cors' \\\n" +
                "  -H 'Sec-Fetch-Site: same-origin' \\\n" +
                "  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.289 Safari/537.36' \\\n" +
                "  -H 'sec-ch-ua: \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"' \\\n" +
                "  -H 'sec-ch-ua-mobile: ?0' \\\n" +
                "  -H 'sec-ch-ua-platform: \"Windows\"' \\\n" +
                "  --compressed";
        String url = "https://blog.csdn.net/community/home-api/v1/get-business-list?page=${page}&size=100&businessType=blog&orderby=&noMore=false&year=&month=&username=weixin_41883161";
        HttpHeaders httpHeaders = RestTemplateService.getHttpHeaders(curl);
        List<Article> articles = new ArrayList<>();
        for (int i = 0; i < 2; i++) {
            String response = RestTemplateService.exchange(url.replace("${page}",String.valueOf(i+1)),HttpMethod.GET,httpHeaders);
            articles.addAll(JSON.parseObject(response).getJSONObject("data").getJSONArray("list").toJavaList(Article.class));
        }
        return articles;
    }
}
@Data
class Article {
    private boolean forcePlan;
    private long articleId;
    private String formatTime;
    private int collectCount;
    private String description;
    private int diggCount;
    private String title;
    private int type;
    private String url;
    private int commentCount;
    private String editUrl;
    private String postTime;
    private boolean top;
    private List<String> picList;
    private int viewCount;

}